
/**
 * 根据主题ID获取SubjectTopic 信息. 并改换页面背景色.
 * @param id
 */
function channgeSubjectTopicBg(topic_bg_image)
{
	if(topic_bg_image !='' || topic_bg_image !='')
	{
		$("body").css("background","url('"+topic_bg_image+"') 50% 0% no-repeat rgb(240, 240, 240)");
	} 
}


/**
 * 加载工作动态信息.
 * @param subject_topic_id
 */
function loadMenus(subject_topic_id)
{
	$.ajax({  
		type: "POST",  
        url: '../WebSubject/loadSubjectMenus.json',  
        data:{  
        	topic_id:subject_topic_id,		    	    	  
	    },  
	    cache:false,  
	    dataType:'json',  
	    success:function(data) { 
	    	if(data!=null && data.length>0){
	    		data.forEach(function(e){  
	    			switch (e.flag)
	    			{
		    			case 'gzdt':  //工作动态.
		    				var gzdtTitle = "";
		    				if(e.title == "" || e.title=='NULL')
		    					{
		    						gzdtTitle = "<span>工作</span>动态";
		    					}
		    				else
		    					{
			    					var temStr = e.title;
			    					var len = temStr.length;
			    					gzdtTitle="<span>"+temStr.substring(0,2)+"</span>" + temStr.substring(2,len); 
		    					}
		    				$("#a_gzdt_menu").append(gzdtTitle);  //添加页面显示样式.
		    				$("#a_gzdt_menu").attr("href","../WebSubject/SubMenuPage.htm?id="+e.id);
		    				break;
		    			case 'gzjb':  //工作简报
		    				var gzjbtitle="";
		    				if(e.title=="" || e.title == "NULL")
		    					{
		    						gzjbtitle = "<span>工作</span>简报";
		    					}else
		    					{
		    						gzjbtitle="<span>"+(e.title).substring(0,2)+"</span>" + (e.title).substring(2,(e.title.length)); 
		    					}
		    					$("#a_gzjb_menu").append(gzjbtitle);
		    					$("#a_gzjb_menu").attr("href","../WebSubject/SubMenuPage.htm?id="+e.id);
		    				break;
		    			case 'tzgg':  //通知公告
		    				var tzggtitle="";
		    				if(e.title=="" || e.title == "NULL")
		    					{
		    						tzggtitle = "<span>通知</span>公告";
		    					}else
		    					{
		    						tzggtitle="<span>"+(e.title).substring(0,2)+"</span>" + (e.title).substring(2,(e.title.length)); 
		    					}
		    					$("#a_tzgg_menu").append(tzggtitle);
		    					$("#a_tzgg_menu").attr("href","../WebSubject/SubMenuPage.htm?id="+e.id);
		    				break;
		    			case 'zcjd':  //政策解读
		    				var zcjdtitle="";
		    				if(e.title=="" || e.title == "NULL")
		    					{
		    						zcjdtitle = "<span>政策</span>解读";
		    					}else
		    					{
		    						zcjdtitle="<span>"+(e.title).substring(0,2)+"</span>" + (e.title).substring(2,(e.title.length)); 
		    					}
		    					$("#a_zcjd_menu").append(zcjdtitle);
		    					$("#a_zcjd_menu").attr("href","../WebSubject/SubMenuPage.htm?id="+e.id);
		    				break;
		    			case 'zcwj':  //政策文件
		    				var zcwjtitle="";
		    				if(e.title=="" || e.title == "NULL")
		    					{
		    					zcwjtitle = "<span>政策</span>文件";
		    					}else
		    					{
		    						zcwjtitle="<span>"+(e.title).substring(0,2)+"</span>" + (e.title).substring(2,(e.title.length)); 
		    					}
		    					$("#a_zcwj_menu").append(zcwjtitle);
		    					$("#a_zcwj_menu").attr("href","../WebSubject/SubMenuPage.htm?id="+e.id);
		    				break;
	    			}
          
	    		});
	    	}	
	    },  
	     error : function(XMLHttpRequest, textStatus, errorThrown) {  
	       
	         XMLHttpRequest.status;
	         XMLHttpRequest.readyState;
	         textStatus;
	     }  
	});
}